using VIT.Library.Web;
using System.Collections.Generic;
using System.Web;
using System;

namespace VIT.Web.UI
{
    abstract public class VITSkin : System.Web.UI.UserControl
    {
        private string TemplatePath
        {
            get
            {
                string curentPath = URL.getCurrentPath();
                bool isAdminPath = curentPath.ToLower().Contains("admin");
                if (isAdminPath) return Convert.ToString(HttpContext.Current.Application["TemplatePathAdmin"]);
                return Convert.ToString(HttpContext.Current.Application["TemplatePath"]);
            }
            set
            {
                string curentPath = URL.getCurrentPath();
                bool isAdminPath = curentPath.ToLower().Contains("admin");
                if (isAdminPath) HttpContext.Current.Application["TemplatePathAdmin"] = value;
                else HttpContext.Current.Application["TemplatePath"] = value;
            }
        }

        public string Title { get; set; }
        public string Content { get; set; }
        public string URLTemplatePath;

        // URL
        public string URLCurrentPath;
        public string URLCurrentPathAndQuery;
        public string URLRoot;
        public string URLBaseDir;

        public VITSkin()
        {
            URLCurrentPath = URL.getCurrentPath();
            URLCurrentPathAndQuery = URL.getPathAndQuery();
            URLRoot = URL.baseUrl;
            URLBaseDir = URL.baseDir;
            this.URLTemplatePath = this.TemplatePath;
        }
    }
}
